package com.atguigu01._this;

/**
 * ClassName: PersonTest
 * Description:
 *
 * @Author liu
 * @Create 2024/10/23 21:34
 * @Version 1.0
 */
public class PersonTest {
    public static void main(String[] args) {
        Person p1 = new Person("lucy");
        System.out.println(p1.name);

        Person p2 = new Person("mike","323@qq.com");
        System.out.println(p2.name+" "+p2.email);
    }

}

class Person{
    String name;
    int age;

    String email;


    //构造器
    public  Person(){

    }
    public Person(String n){
        name =n;
        eat();
    }
    public Person(String name,String email){
        this.name = name;
        this.email = email;
    }
    public void setAge(int age){
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void eat( ){
        System.out.println("人吃饭");
        sleep();
        //本质为
        this.sleep();
     }
     public void sleep(){
         System.out.println("人睡觉");
     }

}